
public class Leetcode101 {
    public boolean isSymmetric(TreeNode root) {
        return like(root.left, root.right);
    }

    private boolean like(TreeNode treeNode1, TreeNode treeNode2) {
        if (treeNode1 == null && treeNode2 == null) {
            return true;
        } else if (treeNode1 != null && treeNode2 != null) {
            return treeNode1.val == treeNode2.val && like(treeNode1.left, treeNode2.right) && like(treeNode1.right, treeNode2.left);
        } else {
            return false;
        }
    }
}
